package com.myown.rabbitmq;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class MQSender {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    //发送秒杀信息
    public void sendSeckillMessage(String message){
        log.info("发送消息："+message);
        rabbitTemplate.convertAndSend("seckillExchange","seckill.message",message);
    }















//    public void send(Object msg){
//        log.info("发送消息："+msg);
//        rabbitTemplate.convertAndSend("queue",msg);
//    }
//
//    public void send03(Object msg){
//        log.info("发送消息（QUEUE01接收）："+msg);
//        rabbitTemplate.convertAndSend("topicExchange","queue.red.message",msg);
//    }
//
//    public void send04(Object msg){
//        log.info("发送消息（QUEUE12接收）："+msg);
//        rabbitTemplate.convertAndSend("topicExchange","tom.queue.red.message",msg);
//    }
}
